package com.itheima.service.pmsService.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.itheima.domain.db.pms.PmsProductAttributeValue;
import com.itheima.mapper.pmsMapper.PmsProductAttributeValueMapper;
import com.itheima.service.pmsService.PmsProductAttributeValueService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PmsProductAttributeValueServiceImpl implements PmsProductAttributeValueService {

    @Autowired
    PmsProductAttributeValueMapper pmsProductAttributeValueMapper;

    @Override
    public void add(PmsProductAttributeValue value) {
        pmsProductAttributeValueMapper.insert(value);
    }

    @Override
    public List<PmsProductAttributeValue> getInfoByBrandId(Long id) {
        LambdaQueryWrapper<PmsProductAttributeValue> lqw = new LambdaQueryWrapper<>();
        lqw.eq(PmsProductAttributeValue::getProductId,id);
        return pmsProductAttributeValueMapper.selectList(lqw);
    }

    @Override
    public void update(PmsProductAttributeValue value) {
        pmsProductAttributeValueMapper.updateById(value);
    }
}
